feat(storybook): build out Code Editors pattern pages - #1111
Conversation
|
Apollo Coded App preview deployments are ready.
|
Dependency License Review
License distribution
Excluded packages
|
There was a problem hiding this comment.
🟡 Changes recommended
There are confirmed issues in Storybook content (em-dash usage) and a LiveMonacoEditor control bug (defaultValue vs value) that can desync demos relying on external state.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Builds out a new Storybook “Patterns > Code Editors” documentation section in apollo-wind, aligns CodeMirror theme tokens with Monaco for Future themes, and refactors a large workbench composition out of a *.stories.tsx file to avoid Storybook CSF auto-detection collisions.
Changes:
- Added/expanded Storybook pattern pages for Monaco + CodeMirror usage, variable insertion, and a canvas-panel “Layout Pattern” example.
- Updated CodeMirror Future theme background tokens to match Monaco’s
editor.background. - Extracted
ErrorAndValidationWorkbenchinto a standalone.tsxmodule and updated Storybook sorting to include the new Patterns section.
File summaries
| File | Description |
|---|---|
| packages/apollo-wind/src/editor-themes/codemirror.ts | Aligns Future dark/light CodeMirror background tokens to match Monaco. |
| packages/apollo-wind/src/components/ui/code-editors.stories.tsx | Adds the new “Patterns/Code Editors” documentation pages, demos, and theme previews. |
| packages/apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel.stories.tsx | Renames panel editor stories to avoid collisions with the new Code Editors pages. |
| apps/storybook/src/patterns/LayoutPatterns.stories.tsx | Removes the inlined workbench implementation and consumes the extracted component. |
| apps/storybook/src/patterns/ErrorAndValidationWorkbench.tsx | New extracted workbench component used by multiple pattern pages. |
| apps/storybook/.storybook/preview.tsx | Stabilizes sidebar ordering for the new Patterns section. |
Review details
Suppressed comments (2)
packages/apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel.stories.tsx:1313
- The Storybook story name uses an em dash character, which is discouraged in Storybook documentation content. Prefer a colon (or similar) separator.
export const CompactEditor: Story = {
name: 'Panel — Compact Editor',
render: () => <CompactEditorStory />,
packages/apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel.stories.tsx:1525
- The Storybook story name uses an em dash character, which is discouraged in Storybook documentation content. Prefer a colon (or similar) separator.
export const InputEditor: Story = {
name: 'Panel — Inline Editor',
render: () => <InputEditorStory />,
- Files reviewed: 6/6 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Storybook visual diffBaseline is the deployed main Storybook, so changes merged to main after this branch was last updated can also appear here. Logs Updated (PT): Sep 23, 2026, 05:08:54 PM |
📊 Coverage + size by packagePer-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.
"Coverage" is each package's own |
There was a problem hiding this comment.
🔵 Needs a closer look
There are new cross-workspace imports in code-editors.stories.tsx (deep apollo-react source imports and a package→app dependency) that should be corrected/avoided to match repo conventions and reduce coupling.
Review details
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
packages/apollo-wind/src/components/ui/code-editors.stories.tsx:10
- This story file in
packages/apollo-windimports a component fromapps/storybook, creating a package→app dependency that makes the story harder to reuse and can break isolated package typechecks/builds. Consider movingErrorAndValidationWorkbenchinto a shared location (e.g., an apollo-react canvas story template) or duplicating the minimal workbench composition locally within this storybook section.
This issue also appears on line 11 of the same file.
packages/apollo-wind/src/components/ui/code-editors.stories.tsx:13
- These imports reach into apollo-react’s source tree via a relative path. Prefer consuming the public canvas entrypoints (as other Storybook code does) so refactors inside apollo-react don’t silently break this story and to avoid cross-workspace relative coupling.
import { CanvasTakeoverModal } from '../../../../apollo-react/src/canvas/components/CanvasTakeoverModal/CanvasTakeoverModal';
import { NodePropertyPanel } from '../../../../apollo-react/src/canvas/components/NodePropertyPanel/NodePropertyPanel';
import { withCanvasProviders } from '../../../../apollo-react/src/canvas/storybook-utils';
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
This PR has been stale for over 2 weeks with no new commits. Closing — feel free to reopen if you'd like to continue this work. To keep a PR exempt from this automation, add the |
76ab0cc to
9a438ff
Compare
9a438ff to
dd0ee27
Compare
dd0ee27 to
2c68548
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved moderate issues affect takeover scoping, editor accessibility, text-mode editing, and Monaco global configuration.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 3
Open (3)
Resolved since last review (2)
2c68548 to
3b753b7
Compare
3b753b7 to
96bf359
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Address state loss when switching themes and ensure the lockable editor label focuses the Monaco editor.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (2)
Resolved since last review (1)
96bf359 to
fcdd8b7
Compare
fcdd8b7 to
b5f14bb
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved moderate issues affect state preservation, editor synchronization, accessibility, and active-line visibility.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
b5f14bb to
cc655ed
Compare
The Future Monaco and CodeMirror themes hardcoded Tailwind v3 hex for every zinc/cyan/emerald/amber/violet step, while apollo-core ships the Tailwind v4 values for the same steps (e.g. zinc-400 #a1a1aa vs #9f9fa9, cyan-400 #22d3ee vs #00d3f2). Snap every Future value to the apollo-core hex for the step it already names, so the editors match the --code-* and surface tokens they document. Step choices are unchanged. Also: - Future Dark CodeMirror background moves from zinc-900 to zinc-800 to match Monaco's editor.background (Future Light already matches at white via the promoted surface-overlay token). - Future Dark Monaco popups (suggest, hover, widget) use surface-overlay (zinc-800) instead of zinc-950, the page background, matching Future Light. Suggest selected rows use background-selected in both Future themes (zinc-700 / zinc-200). - All six Monaco themes now set suggest widget foregrounds. Without them Monaco fell back to its defaults: white text on the Future Light selected row (unreadable) and a stock blue match highlight in place of each theme's accent. - All six Monaco themes color bracket pairs with the theme's punctuation color instead of Monaco's default gold/orchid/blue, matching CodeMirror, and unexpected brackets with error-text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Renamed "Editor Full" / "Editor Compact" / "Editor Inline" to "Panel: Full Editor" / "Panel: Compact Editor" / "Panel: Inline Editor". These names collided with the new Apollo Wind > Patterns > Code Editors pages of the same names, which document a different, unrelated set of Monaco/CodeMirror examples. The collision made both sets of stories hard to tell apart in search and the sidebar.
cc655ed to
f2aae0c
Compare
Adds a full "Apollo Wind > Patterns > Code Editors" documentation section covering how to compose Monaco and CodeMirror across the app, and fixes several real bugs surfaced while building it out: - New pages: Editor Full, Editor Compact, Editor Input, Editor Variables, and a canvas-panel Layout Pattern example, alongside the existing Overview / Reference Monaco / Reference CodeMirror / Themes pages. - Editor Variables demonstrates inserting a variable both ways: through a VariablePicker "Insert" dropdown and by typing `$` in the editor, covering both PromptEditor (ref-based insertVariableToken) and Monaco (cursor-position insert via editor.executeEdits, the same pattern already used in NodePropertyPanel's panel composition stories). - Layout Pattern reuses the shared FullWorkbenchComposition template, which gains an optional renderRightPanel prop so other pattern pages can supply their own panel. Its panel header matches the other workbench panels (node icon, no header action). The expression takeover uses the same Modal + ModalContent variant="takeover" pattern as the shared node takeover (not the deprecated CanvasTakeoverModal), opens straight into fullscreen, and has Run in its header as a secondary button. - Input Editor: the lockable-field example mounts Monaco borderless in the field's own row, like NodePropertyPanel's inline editor, instead of a nested bordered box, and passes a styled Label through the label slot. The field's id, aria-*, and data-slot are forwarded to Monaco's focus element and the editor is named via ariaLabel, so validation and InputGroup focus styling reach it. Clicking the field label focuses the editor, since a label can't activate Monaco's EditContext div. The Monaco and CodeMirror inputs use the default InputGroup fill and share one code-mode treatment (header, no line numbers, wrapping, height, type size, Future radius). - Field Type guidance links its insert-variable section and the matching audit rows to Editor Variables for the code editor implementation. - Fixed: Monaco's TS diagnostics flagged undeclared identifiers in these illustrative snippets as errors. Semantic validation is disabled; syntax validation stays on so malformed code still surfaces. These TypeScript defaults are global to Monaco, so they apply only while a demo editor is mounted and the previous defaults are restored afterwards. Models now use a unique .tsx URI with JSX enabled, since the full sample is a React component and every JSX line was reported as a syntax error. - Fixed: LiveMonacoEditor forwarded value via defaultValue, so external updates to an already-mounted controlled editor were ignored. It is now controlled when a caller passes onChange and uncontrolled otherwise, so static samples can't reconcile a constant value over user edits. The Monaco input and Editor Variables demos keep their expression in state, so code-mode edits and inserted variables survive re-renders. The CodeMirror editors (the input demo and LiveCodeMirrorEditor) rebuild their view on theme changes from the live document instead of the original sample or a keyed remount, so edits survive a theme switch. - Fixed: the lockable-field expression editor had a fixed 84px height inside a 36px input row, so it overflowed and covered the field label above it; it now fills the row and centers one line at any row height. - Fixed: its placeholder was never wired up, so a cleared field showed nothing; it now renders in the same position and font as the built-in expression input's placeholder. - Fixed: CodeMirror's own base styles overrode our theme font-family on `.cm-content`, so CodeMirror editors rendered in the browser's generic monospace font (visibly larger) instead of Apollo's font stack. The rule now inherits from the themed root. - Fixed: Monaco and CodeMirror examples (Editor Full/Compact, Themes) used mismatched heights since CodeMirror auto-sizes to its content; both now share an explicit height so side-by-side comparisons line up. - Storybook sidebar: added "Patterns" > ["Layout Patterns", "Code Editors"] to storySort so the new section has a stable position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f2aae0c to
71ffb6a
Compare


Summary
Builds out a full "Apollo Wind > Patterns > Code Editors" documentation section covering how to compose Monaco and CodeMirror across the app. It also aligns every exported editor theme with the current apollo-core tokens, including the Future Light tokens promoted in #1204, and fixes several real bugs found along the way.
Rebased onto
mainafter #1204. This PR is three commits:fix(apollo-wind): align editor themes with apollo-core tokensfix(apollo-react): disambiguate Node Property Panel editor story namesfeat(storybook): build out the Code Editors pattern pagesEditor themes (
@uipath/apollo-wind/editor-themes)#a1a1aavs#9f9fa9, cyan-400#22d3eevs#00d3f2). Every Future value now uses the apollo-core hex for the step it already names, so syntax colors match the--code-*tokens exactly. Step choices are unchanged. Classic and HC themes already matched.New pages
VariablePicker"Insert" dropdown or typing$in the editor. Covers bothPromptEditor(ref-basedinsertVariableToken) and Monaco (cursor-position insert viaeditor.executeEdits, the same pattern used inNodePropertyPanel's panel composition stories).FullWorkbenchCompositiontemplate, which gains an optionalrenderRightPanelprop so other pattern pages can supply their own panel. The panel header matches the other workbench panels (node icon, no header action). The expression takeover uses the sameModal+ModalContent variant="takeover"pattern as the shared node takeover (not the deprecatedCanvasTakeoverModal), opens straight into fullscreen, and has Run in its header as a secondary button.Bugs fixed along the way
.tsxURI with JSX enabled, since the full sample is a React component and every JSX line was reported as a syntax error.LiveMonacoEditorforwardedvalueviadefaultValue, so external updates to an already-mounted controlled editor were ignored. It is now controlled when a caller passesonChangeand uncontrolled otherwise, so static samples can't reconcile a constant value over user edits. The Monaco input and Editor Variables demos keep their expression in state, so code-mode edits and inserted variables survive re-renders and mode switches. The CodeMirror editors (the input demo andLiveCodeMirrorEditor) rebuild their view on theme changes from the live document instead of the original sample or a keyed remount, so edits survive a theme switch.NodePropertyPanel's inline editor, with a placeholder in the same position and font as the built-in expression input. Its label goes through thelabelslot as a styledLabel; a plain string rendered unstyled. The field'sid,aria-*, anddata-slotare forwarded to Monaco's focus element, and the editor is named viaariaLabel, so validation andInputGroupfocus styling reach it. Clicking the field label focuses the editor, since a label can't activate Monaco's EditContextdiv.bg-surface-overlayfill (gray in Classic Light, unlike the default field) and had different code-mode treatments. Both now use the defaultInputGroupfill and share one code mode: header, no line numbers, wrapping, height, type size, and the Future field radius..cm-content, so CodeMirror editors rendered in the browser's generic monospace font instead of Apollo's font stack. Fixes every CodeMirror instance in this file.Other changes
Patterns > [Layout Patterns, Code Editors]to Storybook'sstorySortso the new section has a stable sidebar position.Flow.stories.tsx: applied Biome's safe import-order fix, which was already failing onmain.Test plan
biome checkclean on all changed filesturbo run typecheckclean forapollo-wind,apollo-react,storybook-app--code-*, surface-overlay, and background-selected tokensFullWorkbenchCompositionand the expression takeover opens fullscreen, matching the shared node takeoverFollow-ups (separate PRs)
--code-punctuationmaps toforeground-disable(zinc-400) in Future Light, which is faint on white and collides with the comment color. The editor themes intentionally keep zinc-500.font-monowhile Monaco editors (includingNodePropertyPanel's inline editor) use the system mono stack, so a value changes font when a field switches into code mode.foundation/colors.stories.tsx,foundation/Future/colors.ts, and a few others) still hardcode Tailwind v3 hex.🤖 Generated with Claude Code